package com.zzyl.framework.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.framework.config.properties.AliIoTConfigProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IotClientConfig {
//    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;

//    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;
    @Bean
    public Client client(AliIoTConfigProperties aliIoTConfigProperties) throws Exception {
        Config config = new Config()
        // 您的AccessKey ID
            .setAccessKeyId("LTAI5tQsFTBD8NZuptCrjPCN")
        // 您的AccessKey Secret
                .setAccessKeySecret("BH06BaY6ESAG0FRV8ElmrAUWTT2T7D");
        // 访问的域名

        config.setRegionId(aliIoTConfigProperties.getRegionId());
        return new Client(config);
    }


}
